package com.coolweather.android;

import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import com.coolweather.android.databinding.ActivityMainBinding;
import com.coolweather.android.db.Province;
import com.coolweather.android.util.HttpUtil;
import com.coolweather.android.util.Utility;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

public class MainActivity extends AppCompatActivity {

    ActivityMainBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        binding= ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

//        Province province=new Province();
//        province.setId(1);
//        province.setProvinceName("测试");
//        province.setProvinceCode(2);
//        province.save();
//
//        Student stu=new Student();
//        stu.setId(1);
//        stu.setGendar(true);
//        stu.setName("张三");
//        stu.setSno("10001");
//        stu.save();
//
//        HttpUtil.sendOkHttpRequest("http://guolin.tech/api/china", new Callback() {
//            @Override
//            public void onFailure(@NotNull Call call, @NotNull IOException e) {
//
//            }
//
//            @Override
//            public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
//                String result = response.body().string();
//                Log.d("Test", "onResponse: "+ result);
//                boolean flag = Utility.handleProvinceResponse(result);
//                Log.d("Test", "onResponse save: "+ flag);
//
//            }
//        });
    }
}